import type { ApiPagination, ApiPaginationParams } from '#types/utils'
import { requestClient } from '../request'
import type {
    messageTemplatItemForm,
    messageTemplatPageListItem
} from './model/messageTemplatModel'

// 用户管理
export default class SysMessageTemplatApi {
    static get inst() {
        return (
            SysMessageTemplatApi._inst || (SysMessageTemplatApi._inst = new SysMessageTemplatApi())
        )
    }
    private static _inst: SysMessageTemplatApi
    add(params: Partial<messageTemplatItemForm>) {
        return requestClient.post<null>('/messageTemplate/add', params)
    }
    delete(ids: Array<number | string>) {
        return requestClient.delete<null>(`/messageTemplate/delete/${ids}`)
    }
    edit(id: number | string, params: Partial<messageTemplatItemForm>) {
        return requestClient.put<null>(`/messageTemplate/edit/${id}`, params)
    }
    /**
     * 站点管理分页
     * @param params
     */
    getPageList(params: ApiPaginationParams<{ username?: string }>) {
        return requestClient.get<ApiPagination<messageTemplatPageListItem>>(
            '/messageTemplate/index',
            {
                params
            }
        )
    }
}
